package com.pic.mgt.scheduler;

import java.util.List;
import java.util.Map;

import org.quartz.Trigger;

public interface QuartzAutoJob extends AutoJob {
	
	/**
	 * 加入工作排程 (使用 cronExpression)
	 * @param cronExpression Quartz 的 cron expression
	 * @param jobClass
	 * @param jobData
	 * @param jobName
	 * @param groupName
	 * @throws ScheduleAutoJobException
	 */
	public void scheduleCronJob (String cronExpression, Class jobClass,
			 Map jobData, String jobName, String groupName, String jobDescription) throws ScheduleAutoJobException;
	
	/**
	 * 重設工作排程時間
	 * @param cronExpression Quartz 的 cron expression
	 * @param groupName
	 * @param jobName
	 * @throws ScheduleAutoJobException
	 */
	public void rescheduleCronJob (String cronExpression, String groupName, String jobName, String jobDescription) throws ScheduleAutoJobException;
	
	/**
	 * 取得屬於trigger群組的 trigger 出來
	 * @param triggerGroupName
	 * @return List<Trigger>. 不會為 null .
	 */
	public List<Trigger> getTriggersByGroupName(String triggerGroupName) throws ScheduleAutoJobException;
	
	/**
	 * 取得該 Trigger 的狀態。
	 * @param triggerName
	 * @param triggerGroupName
	 * @return 回傳為數值，見  Trigger.STATE_NORMAL, Trigger.STATE_PAUSED, Trigger.STATE_COMPLETE, Trigger.STATE_ERROR, Trigger.STATE_BLOCKED, Trigger.STATE_NONE
	 * @throws ScheduleAutoJobException
	 */
	public int getTriggerState(String triggerName, String triggerGroupName) throws ScheduleAutoJobException;
	
	public void pauseTrigger(String triggerName, String triggerGroup) throws ScheduleAutoJobException;
	
	public void pauseTriggerGroup(String triggerGroup) throws ScheduleAutoJobException;
	
	public void resumeTrigger(String triggerName, String triggerGroup) throws ScheduleAutoJobException;
	
	public void resumeTriggerGroup(String triggerGroup) throws ScheduleAutoJobException;
}
